package com.fusheng.demo

import android.os.Bundle
import android.os.Looper
import android.util.Log
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.fusheng.utils.LogMonitorPrinter

class IndexActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_index)

        Looper.getMainLooper().setMessageLogging(LogMonitorPrinter(Log.DEBUG, "Monitor-10"))

//        posMsg()
    }

    /**
     * 死循环一直写入主线程
     */
    private fun posMsg() {
        findViewById<TextView>(R.id.showText).postDelayed(Runnable() {
            Thread.sleep(10)
            posMsg()
        }, 10)
    }

    override fun onResume() {
        super.onResume()

        Log.e("MMMM", "==${this}== @onResume")
    }

    override fun onPause() {
        super.onPause()

        Log.e("MMMM", "==${this}== @onPause")
    }
}